package dice.sinanya.dice.get;

import com.forte.qqrobot.beans.messages.types.MsgGetTypes;
import dice.sinanya.entity.EntityTypeMessages;

import static dice.sinanya.db.rules.Rule.selectRule;
import static dice.sinanya.system.MessagesTag.TAG_DW;
import static dice.sinanya.tools.makedata.Sender.sender;

/**
 * @author SitaNya
 * 日期: 2019-08-20
 * 电子邮箱: sitanya@qq.com
 * 维护群(QQ): 162279609
 * 有任何问题欢迎咨询
 * 类说明:
 */
public class Dw {
    private final EntityTypeMessages entityTypeMessages;

    public Dw(EntityTypeMessages entityTypeMessages) {
        this.entityTypeMessages = entityTypeMessages;
    }

    /**
     * 获取煤气灯特质并发送
     */
    public void getDw() {
        String tag = TAG_DW;
        String msg = entityTypeMessages.getMsgGet().getMsg().trim().replaceFirst(tag.substring(0, tag.length() - 2), "").trim();
        String result = selectRule("dw", "dw", msg);
        sender(entityTypeMessages, result);
        try {
            Thread.sleep(988);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        if (entityTypeMessages.getMsgGetTypes() != MsgGetTypes.privateMsg) {
            entityTypeMessages.getMsgSender().SENDER.sendPrivateMsg(entityTypeMessages.getFromQqString(), "私聊也发一份防腾讯屏蔽\n" + result);
        }
    }

}
